using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

using Visio = Microsoft.Office.Interop.Visio;

namespace Scenario.Modeler
{
	/// <summary>
	/// Summary description for LayersManager.
	/// </summary>
	public class LayersManager : System.Windows.Forms.Form
	{
		public Visio.Pages Pages = null;

		private System.Windows.Forms.TreeView tvLayers;
		private System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.TextBox textBox2;
		private System.Windows.Forms.TextBox textBox3;
		private System.Windows.Forms.TextBox textBox4;
		private System.Windows.Forms.Button Add;
		private System.Windows.Forms.Button Modify;
		private System.Windows.Forms.Button button1;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public LayersManager()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            this.tvLayers = new System.Windows.Forms.TreeView();
            this.textBox1 = new System.Windows.Forms.TextBox();
            this.textBox2 = new System.Windows.Forms.TextBox();
            this.textBox3 = new System.Windows.Forms.TextBox();
            this.textBox4 = new System.Windows.Forms.TextBox();
            this.Add = new System.Windows.Forms.Button();
            this.Modify = new System.Windows.Forms.Button();
            this.button1 = new System.Windows.Forms.Button();
            this.SuspendLayout();
            // 
            // tvLayers
            // 
            this.tvLayers.Location = new System.Drawing.Point(7, 14);
            this.tvLayers.Name = "tvLayers";
            this.tvLayers.Size = new System.Drawing.Size(220, 256);
            this.tvLayers.TabIndex = 0;
            // 
            // textBox1
            // 
            this.textBox1.Location = new System.Drawing.Point(233, 14);
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new System.Drawing.Size(140, 20);
            this.textBox1.TabIndex = 1;
            this.textBox1.Text = "textBox1";
            // 
            // textBox2
            // 
            this.textBox2.Location = new System.Drawing.Point(233, 42);
            this.textBox2.Name = "textBox2";
            this.textBox2.Size = new System.Drawing.Size(140, 20);
            this.textBox2.TabIndex = 2;
            this.textBox2.Text = "textBox2";
            // 
            // textBox3
            // 
            this.textBox3.Location = new System.Drawing.Point(233, 69);
            this.textBox3.Name = "textBox3";
            this.textBox3.Size = new System.Drawing.Size(140, 20);
            this.textBox3.TabIndex = 3;
            this.textBox3.Text = "textBox3";
            // 
            // textBox4
            // 
            this.textBox4.Location = new System.Drawing.Point(233, 97);
            this.textBox4.Name = "textBox4";
            this.textBox4.Size = new System.Drawing.Size(140, 20);
            this.textBox4.TabIndex = 4;
            this.textBox4.Text = "textBox4";
            // 
            // Add
            // 
            this.Add.Location = new System.Drawing.Point(233, 243);
            this.Add.Name = "Add";
            this.Add.Size = new System.Drawing.Size(40, 27);
            this.Add.TabIndex = 5;
            this.Add.Text = "Add";
            // 
            // Modify
            // 
            this.Modify.Location = new System.Drawing.Point(280, 243);
            this.Modify.Name = "Modify";
            this.Modify.Size = new System.Drawing.Size(40, 27);
            this.Modify.TabIndex = 6;
            this.Modify.Text = "Mod";
            // 
            // button1
            // 
            this.button1.Location = new System.Drawing.Point(327, 243);
            this.button1.Name = "button1";
            this.button1.Size = new System.Drawing.Size(33, 27);
            this.button1.TabIndex = 7;
            this.button1.Text = "button1";
            // 
            // LayersManager
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(397, 320);
            this.Controls.Add(this.button1);
            this.Controls.Add(this.Modify);
            this.Controls.Add(this.Add);
            this.Controls.Add(this.textBox4);
            this.Controls.Add(this.textBox3);
            this.Controls.Add(this.textBox2);
            this.Controls.Add(this.textBox1);
            this.Controls.Add(this.tvLayers);
            this.Name = "LayersManager";
            this.Text = "LayersManager";
            this.Load += new System.EventHandler(this.LayersManager_Load);
            this.ResumeLayout(false);
            this.PerformLayout();

		}
		#endregion

		private void LayersManager_Load(object sender, System.EventArgs e)
		{
			TreeNode root = tvLayers.Nodes.Add( "Main");
			TreeNode node = root.Nodes.Add("All Pages");

			for (int pageIndex = 1; pageIndex <= this.Pages.Count; pageIndex++)
			{
				Visio.Page page = this.Pages[pageIndex];

				TreeNode nodePage = root.Nodes.Add(page.Name);

				for ( int i=1; i<=page.Layers.Count;i++)
				{
					Visio.Layer layer = page.Layers[i];

					TreeNode nodeLayer = nodePage.Nodes.Add(layer.Name);
				}
			}
		}

	}
}
